package com.platform.service.impl;

import com.platform.dao.LogisticsDao;
import com.platform.entity.LogisticsEntity;
import com.platform.service.LogisticsService;
import com.platform.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * 物流表Service实现类
 *  订单管理:发货管理
 * @author lipengjun
 * @email 939961241@qq.com
 * @date 2019-02-25 20:27:31
 */
@Service("logisticsService")
public class LogisticsServiceImpl implements LogisticsService {
    @Autowired
    private LogisticsDao logisticsDao;

    @Override
    public LogisticsEntity queryObject(Integer id) {
        return logisticsDao.queryObject(id);
    }

    @Override
    public List<LogisticsEntity> queryList(Map<String, Object> map) {
        Object date = map.get("date");
        if(date!=null && date != ""){
            Date tomorrow = DateUtils.minusDateForDay(date.toString(),1);
            map.put("tomorrow",tomorrow);
        }
        return logisticsDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return logisticsDao.queryTotal(map);
    }

    @Override
    public int save(LogisticsEntity logistics) {
        return logisticsDao.save(logistics);
    }

    @Override
    public int update(LogisticsEntity logistics) {
        return logisticsDao.update(logistics);
    }

    @Override
    public int delete(Integer id) {
        return logisticsDao.delete(id);
    }

    @Override
    public int deleteBatch(Integer[] ids) {
        return logisticsDao.deleteBatch(ids);
    }

    @Override
    public boolean check(String orderno) {
        return logisticsDao.check(orderno);
    }

    @Override
    public Map<String, Object> querySmsTemplate(Integer id) {
        return logisticsDao.querySmsTemplate(id);
    }
}
